﻿using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Text;

using PowerCreator.LMS.DL.Project.Entity;
using PowerCreator.LMS.Web.DL.Project;
using PowerCreator.LMS.Common.Script;
public partial class sysadmin_DL_Project_ManageClass : PowerCreator.LMS.Web.Base.WebBasePage
{
    TOClass objClass = new TOClass();
    PowerCreator.LMS.ViewQuery.ViewQuery obj = new PowerCreator.LMS.ViewQuery.ViewQuery();
    private PowerCreator.LMS.Web.DL.User.LoginEntity login = new PowerCreator.LMS.Web.DL.User.LoginEntity();
    private string url = "../../login.aspx";

    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            InitPage();
            string search = GetSearch();
            BinderPager(search);
            BinderPG(search, 1);
            if (CheckUser())
            {
                btnAddNew.Enabled = true;
                btn_DelCheck.Enabled = true;
            }
            else
            {
                btnAddNew.Enabled = false;
                btn_DelCheck.Enabled = false;
            }
        }
    }


    private bool CheckUser()
    {
        bool rt = false;
        if (Session[PowerCreator.LMS.Web.Config.WebConfig.SESSION_USER_USERINFO] == null)
        {
            Script.RedirectNewUrl(url);
        }
        else
        {
            login = (PowerCreator.LMS.Web.DL.User.LoginEntity)Session[PowerCreator.LMS.Web.Config.WebConfig.SESSION_USER_USERINFO];
            if (login == null)
            {
                Script.RedirectNewUrl(url);
            }
            else
            {
                if (login.VOAdvancedUser == null)
                {
                    Script.RedirectNewUrl(url);
                }
                else if (login.VOAdvancedUser.AUserGroup == 1 || login.VOAdvancedUser.AUserGroup == 2)
                {
                    rt = true;
                }
            }
        }

        return rt;

    }
    protected override void InitPage()
    {
        //lbl_InfoTitle_ManagerNew.Text = GetLanageValueByKey("lab_ManagerNew_InfoTitle", PowerCreator.LMS.Language.LanagetItemType.Page);
        //lbl_ManagerNew.Text = "新闻列表";
        btnAddNew.Text = GetLanageValueByKey("btn_AddNew", PowerCreator.LMS.Language.LanagetItemType.Page);
        btnSearch.Text = GetLanageValueByKey("btn_Search", PowerCreator.LMS.Language.LanagetItemType.Page);

        chkAll.Text = GetLanageValueByKey("chkbox_ManagerQuestion_chkboxAll", PowerCreator.LMS.Language.LanagetItemType.Page);
        chkCancel.Text = GetLanageValueByKey("chkbox_ManagerQuestion_chkboxCancel", PowerCreator.LMS.Language.LanagetItemType.Page);

        btn_DelCheck.Text = GetLanageValueByKey("btnDel", PowerCreator.LMS.Language.LanagetItemType.Page);
        btnAddNew.Text = GetLanageValueByKey("btn_AddNew", PowerCreator.LMS.Language.LanagetItemType.Page);
        
        base.InitPage();

        //btnAddNew.Visible = false;
        //if (IsLicensed(PowerCreator.LMS.Action.Core.ActionInfo.AddJob))
        //    btnAddNew.Visible = true;

    }
    private string GetSearch()
    {
        string search = "SELECT TO_Class.Class_Id,TO_Class.Name,  TO_CourseList.CourseListName, TO_Class.Broswer, TO_Class.ClassAssistant, TO_Class.ClassLeader,  TO_Class.ClassLecturer,TO_CourseList.CourseID FROM TO_Class ,TO_CourseList Where TO_Class.ClassCourseListID = TO_CourseList.CourseList_Id";
        if (!string.IsNullOrEmpty(txt_KeyWord.Text))
            search += string.Format(" and Name like '%{0}%'", txt_KeyWord.Text.Trim());
        //如果是超级管理员登录可以查看所有课程
        if (GetLoginEntity.UserName.ToLower() != "admin" && GetLoginEntity.UserName.ToLower() != "administrator")
        {
            search += System.String.Format(" and (TO_Class.Class_Id in (Select FkOID from TauthorityUser as a , TauthorityList as b where a. FkAuthorityID = b.FkAuthorityID and FkUserID ={0} and b.authorityType=2) or Creator={0})", GetLoginEntity.UserID);

        }
        return search;
    }

    protected void BinderPager(string search)
    {
        AspNetPager1.RecordCount = obj.Count(search);
        AspNetPager1.PageSize = obj.Count(search);
    }
    private void BinderPG(string search, int pageIndex)
    {
        string orderby = " Class_Id Desc";
        DataTable dt = obj.Query(search, orderby, LMSPageSize, pageIndex);//所有班级
        dt.Columns.Add("StrState");
     
        for (int i = 0; i < dt.Rows.Count; i++)
        {
            if (dt.Rows[i]["Broswer"].ToString() == "True")
                dt.Rows[i]["StrState"] = "允许";
            else
                dt.Rows[i]["StrState"] = "不允许";
        }
        rptNew.DataSource = dt;
        rptNew.DataBind();
        PreAspNetPager(AspNetPager1);
    }
    //private void BinderPGA(string search,int pageIndex)
    //{
    //    //int intscoresStuCou = 0;
    //    //int intscoresStu = 0;
    //    //int intScoresCls = 0;
    //    //double douAvgScoresCls = 0;
    //    string orderby = " Class_Id Desc";
    //    DataTable dt = obj.Query(search, orderby, LMSPageSize, pageIndex);//所有班级
        
    //    //PowerCreator.LMS.ViewQuery.ViewQuery objView = new PowerCreator.LMS.ViewQuery.ViewQuery();
    //    //string searchView = "";
    //    dt.Columns.Add("StrState");
    //    //dt.Columns.Add("avgScore");
    //    //dt.Columns.Add("levelClass");
    //    //dt.Columns.Add("Batch");
    //    for (int i = 0; i < dt.Rows.Count; i++)
    //    {
    //        //string strClsCourseID = dt.Rows[i]["CourseID"].ToString();
    //        //string[] strCourseIDA = strClsCourseID.Split(',');
    //        ////得到班级批次
    //        //string searchBatch = "select a.Batch_Id,Batch from TO_Batch as a ,TO_CourseList as b ,to_class as c where a.Batch_Id =b.Batch_Id and b.CourseList_Id = c.ClassCourseListID and c.Class_Id={0}";
    //        //DataTable dtBatch = objView.Query(string.Format(searchBatch, dt.Rows[i]["Class_Id"].ToString()));
    //        //string strBatch = dtBatch.Rows[0]["Batch"].ToString();
    //        //string strBatchID = dtBatch.Rows[0]["Batch_Id"].ToString();
    //        ////得到每个班的学员
    //        //string searchUser = "SELECT TO_UserOfClass.UserID FROM TO_Learner ,TO_UserOfClass where TO_Learner.Learner_Id = TO_UserOfClass.UserID and TO_UserOfClass.ClassID=" + dt.Rows[i]["Class_Id"].ToString();
    //        //DataTable dtUser = objView.Query(searchUser);
    //        //for (int m = 0; m < dtUser.Rows.Count;m++ )
    //        //{
    //        //    for (int n = 0; n<strCourseIDA.Length;n++ )
    //        //    {
    //        //        //截取课程id 和 学分 ,0为课程ID，1为学分
    //        //        string []strCourseIDB= strCourseIDA[n].Split('#');
    //        //        //得到每个学员每门课的总学时 
    //        //        string searchCourse = "select sum(SscrlogTotalTime) as studyHours,FKSscrlogCourseID from TStudentStudyCouReslog group by FKSscrlogUserID,FKSscrlogTrainclaID,FKSscrlogCourseID having FKSscrlogUserID={0} and FKSscrlogTrainclaID={1} and FKSscrlogCourseID ={2}";
    //        //        searchView = string.Format(searchCourse, dtUser.Rows[n]["UserID"].ToString(), dt.Rows[i]["Class_Id"].ToString(), strCourseIDB[0]);
    //        //        DataTable dtCourse = objView.Query(searchView);
    //        //        //得到作业完成次数
    //        //        string searchWorkNum = "select count(*) as WorkNum,courseID,Creator ,ClassID from (select courseID,a.Creator,ClassID from TO_UserClassTask as a ,TO_ClassTasks as b where a.task_Id =b.ClassTasks_Id) as tb group by courseID,Creator ,ClassID having Creator ={0} and classID ={1} and courseID ={2}";
    //        //        searchView = string.Format(searchWorkNum, dtUser.Rows[n]["UserID"].ToString(), dt.Rows[i]["Class_Id"].ToString(),strCourseIDB[0]);
    //        //        DataTable dtWorkNum = objView.Query(searchView);
    //        //        //得到作业评论次数
    //        //        string searchTasksReply = "select count(*) as ReplyNum ,Creator,ClassID,courseID from (select courseID,b.Creator,ClassID from TO_ClassTasksReply as a ,TO_UserClassTask as b ,TO_ClassTasks as c  where a.UserTask_Id = b.UserTask_Id and b.task_Id = c.ClassTasks_Id ) as tb group by Creator,ClassID,courseID having Creator ={0} and classID ={1} and courseID ={2}";
    //        //        searchView = string.Format(searchTasksReply, dtUser.Rows[n]["UserID"].ToString(), dt.Rows[i]["Class_Id"].ToString(),strCourseIDB[0]);
    //        //        DataTable dtTasksReply = objView.Query(searchView);

    //        //        //string strCourseID = dtCourse.Rows[0]["FKSscrlogCourseID"];
    //        //        //得到考试成绩
    //        //        string searchExam = "select * from UserPaperHistory where fKUPHistoryClassID={0} and fKUPHistoryUserID ={1} and fKUPHistoryCourseID={2}";
    //        //        searchView = string.Format(searchExam, dt.Rows[i]["Class_Id"].ToString(), dtUser.Rows[n]["UserID"].ToString(), strCourseIDB[0]);
    //        //        DataTable dtExam = objView.Query(searchView);
    //        //        //得到规则
    //        //        string searchRuleList = "select top 1 isnull(TotalTime_Low,0) as TotalTime_Low,isnull(TotalTime_High,0) as TotalTime_High,	isnull(TotalTimeWeightA,0) as TotalTimeWeightA,isnull(WorkFinishTimes_Low,0) as WorkFinishTimes_Low,isnull(WorkFinishTimes_High,0) as WorkFinishTimes_High,isnull(WorkFinishTimesWeightB,0) as WorkFinishTimesWeightB,isnull(WorkCommentTimes_Low,0) as WorkCommentTimes_Low,isnull(WorkCommentTimes_High,0) as WorkCommentTimes_High,isnull(WorkCommentTimesWeightB,0) as WorkCommentTimesWeightB,isnull(WorkTatolWeigthA,0) as WorkTatolWeigthA,isnull(Score_Low,0) as Score_Low,isnull(Score_High,0) as	Score_High,isnull(ScoreWeightA,0) as ScoreWeightA from TO_FormulaOfRule as a,to_rule as b where b.Rule_ID = a.RuleID and FKBatchID ={0} and FKCourseID={1}";
    //        //        searchView = string.Format(searchRuleList, strBatchID, strCourseIDB[0]);
    //        //        DataTable dtRuleList = objView.Query(searchView);
    //        //        //计算平均成绩使用的变量
    //        //        int intHours=0;
    //        //        int intTotalTimeWeightA=0;
    //        //        int TotalTime_Low=0;
    //        //        int TotalTime_High=0;
    //        //        int intScoresHours = 0;

    //        //        int intworkFinishTimes = 0;
    //        //        int intFinishTimesWeightB =0;
    //        //        int WorkFinishTimes_Low = 0;
    //        //        int intWorkScores = 0;
    //        //        int WorkFinishTimes_High = 0;


    //        //        int intTasksReply = 0;
    //        //        int workCommentTimesWeightB = 0;
    //        //        int WorkCommentTimes_Low = 0;
    //        //        int WorkCommentTimes_High = 0;
    //        //        int intScoresComment = 0;

    //        //        int intworkTatolWeightA = 0;
    //        //        int intExam = 0;
    //        //        int intScoreWeightA = 0;
    //        //        int Score_Low = 0;
    //        //        int Score_High = 0;
    //        //        int intScoresExam = 0;

    //        //        //如果没有设置，那么不去计算
    //        //        if (dtCourse.Rows.Count > 0 && dtRuleList.Rows.Count > 0)
    //        //        {
    //        //            //计算每个学员每门课的学分
    //        //             intHours = int.Parse(dtCourse.Rows[n]["studyHours"].ToString());
    //        //             intTotalTimeWeightA = int.Parse(dtRuleList.Rows[0]["TotalTimeWeightA"].ToString());
    //        //             TotalTime_Low = int.Parse(dtRuleList.Rows[0]["TotalTime_Low"].ToString());
    //        //             TotalTime_High = int.Parse(dtRuleList.Rows[0]["TotalTime_High"].ToString());
    //        //             intScoresHours = 0;

    //        //            if (intHours < TotalTime_High && intHours > TotalTime_Low)
    //        //            {
    //        //                intScoresHours = intHours * intTotalTimeWeightA / 100;
    //        //            }
    //        //            else if (intHours >= TotalTime_High && TotalTime_High>0)
    //        //            {
    //        //                intScoresHours = int.Parse(strCourseIDB[1]);
    //        //            }
    //        //            else
    //        //            {
    //        //                intScoresHours = 0;
    //        //            }
    //        //        }
    //        //        if (dtWorkNum.Rows.Count > 0 && dtRuleList.Rows.Count > 0)
    //        //        {
    //        //            //计算作业完成次数得分
    //        //             intworkFinishTimes = int.Parse(dtWorkNum.Rows[n]["WorkNum"].ToString());
    //        //             intFinishTimesWeightB = int.Parse(dtRuleList.Rows[0]["WorkFinishTimesWeightB"].ToString());
    //        //             WorkFinishTimes_Low = int.Parse(dtRuleList.Rows[0]["WorkFinishTimes_Low"].ToString());
    //        //             intWorkScores = 0;
    //        //             WorkFinishTimes_High = int.Parse(dtRuleList.Rows[0]["WorkFinishTimes_High"].ToString());

    //        //            if (intworkFinishTimes < WorkFinishTimes_High && intworkFinishTimes > WorkFinishTimes_Low)
    //        //            {
    //        //                intWorkScores = intworkFinishTimes * intFinishTimesWeightB / 100;
    //        //            }
    //        //            else if (intworkFinishTimes >= WorkFinishTimes_High && WorkFinishTimes_High>0)
    //        //            {
    //        //                intWorkScores = int.Parse(strCourseIDB[1]);
    //        //            }
    //        //            else
    //        //            {
    //        //                intWorkScores = 0;
    //        //            }
    //        //        }
    //        //        if (dtTasksReply.Rows.Count > 0 && dtRuleList.Rows.Count > 0) 
    //        //        {
    //        //            //计算作业提交次数得分
    //        //             intTasksReply = int.Parse(dtTasksReply.Rows[n]["ReplyNum"].ToString());
    //        //             workCommentTimesWeightB = int.Parse(dtRuleList.Rows[0]["workCommentTimesWeightB"].ToString());
    //        //             WorkCommentTimes_Low = int.Parse(dtRuleList.Rows[0]["WorkCommentTimes_Low"].ToString());
    //        //             WorkCommentTimes_High = int.Parse(dtRuleList.Rows[0]["WorkCommentTimes_High"].ToString());
    //        //             intScoresComment = 0;

    //        //            if (intTasksReply < WorkCommentTimes_High && intTasksReply > WorkCommentTimes_Low)
    //        //            {
    //        //                intScoresComment = intTasksReply * workCommentTimesWeightB / 100;
    //        //            }
    //        //            else if (intTasksReply >= WorkCommentTimes_High && WorkCommentTimes_High>0)
    //        //            {
    //        //                intScoresComment = int.Parse(strCourseIDB[1]);
    //        //            }
    //        //            else
    //        //            {
    //        //                intScoresComment = 0;
    //        //            }
    //        //        }


    //        //        if (dtExam.Rows.Count > 0 && dtRuleList.Rows.Count > 0)
    //        //        {
    //        //            //计算考试成绩得分
    //        //             intworkTatolWeightA = int.Parse(dtRuleList.Rows[0]["WorkTatolWeigthA"].ToString());
    //        //             intExam = int.Parse(dtExam.Rows[n]["UPHistoryScore"].ToString());
    //        //             intScoreWeightA = int.Parse(dtRuleList.Rows[0]["ScoreWeightA"].ToString());
    //        //             Score_Low = int.Parse(dtRuleList.Rows[0]["Score_Low"].ToString());
    //        //             Score_High = int.Parse(dtRuleList.Rows[0]["Score_High"].ToString());
    //        //             intScoresExam = 0;

    //        //            if (intExam < Score_High && intExam > Score_Low)
    //        //            {
    //        //                intScoresExam = intExam * intScoreWeightA / 100;
    //        //            }
    //        //            else if (intExam >= Score_High && Score_High>0)
    //        //            {
    //        //                intScoresExam = int.Parse(strCourseIDB[1]);
    //        //            }
    //        //            else
    //        //            {
    //        //                intScoresExam = 0;
    //        //            }
    //        //        }
    //        //        //计算每个学员每门课的学分
    //        //        intscoresStuCou = intScoresHours + (intWorkScores + intScoresComment) * intworkTatolWeightA + intScoresExam;
    //        //        //计算每个学员的总学分
    //        //        intscoresStu = intscoresStu + intscoresStuCou;
    //        //    }
    //        //    //计算每个班级的总学分
    //        //    intScoresCls = intScoresCls + intscoresStu;
    //        //}
    //        ////计算班级平均分
    //        //if(dtUser.Rows.Count>0)
    //        //{
    //        //    douAvgScoresCls = intScoresCls / dtUser.Rows.Count;
    //        //}
    //        //dt.Rows[i]["Batch"] = strBatch;
    //        //dt.Rows[i]["avgScore"] = douAvgScoresCls;//.ToString();
    //        if (dt.Rows[i]["Broswer"].ToString() == "True")
    //            dt.Rows[i]["StrState"] = "允许";
    //        else
    //            dt.Rows[i]["StrState"] = "不允许";
    //    }
    //    //排名
    //    //int sng =2;
    //    //DataView dv = dt.DefaultView;
    //    //dv.Sort = "Batch ,avgScore desc";
    //    //dt = dv.ToTable();
    //    //dt.Rows[0]["levelClass"] = 1;
    //    //for (int j = 1; j < dt.Rows.Count;j++ )
    //    //{
    //    //    if (dt.Rows[j]["Batch"].Equals(dt.Rows[j - 1]["Batch"]))
    //    //    {
    //    //        dt.Rows[j]["levelClass"] =sng;
    //    //        sng++;
    //    //    }
    //    //    else
    //    //    {
    //    //        dt.Rows[j]["levelClass"] = 1;
    //    //        sng = 2;
    //    //    }
    //    //}
    //    rptNew.DataSource = dt;
    //    rptNew.DataBind();
    //    PreAspNetPager(AspNetPager1);
    //}
    protected void rpt_ItemDataBound(object sender, RepeaterItemEventArgs e)
    {
        if ((e.Item.ItemType == ListItemType.Item) || (e.Item.ItemType == ListItemType.AlternatingItem))
        {
            LinkButton lnkbtn_editor = (LinkButton)e.Item.FindControl("lnkbtn_editor");
            LinkButton lbtn = (LinkButton)e.Item.FindControl("lnkbtn_del");
            LinkButton lnkbtn_check = (LinkButton)e.Item.FindControl("lnkbtn_check");
            LinkButton lnkbtn_Manage = (LinkButton)e.Item.FindControl("lnkbtn_Manage");
            Label lbl_ClassLecturer = (Label)e.Item.FindControl("lbl_ClassLecturer");
            Label lbl_ClassLeader = (Label)e.Item.FindControl("lbl_ClassLeader");
            Label lbl_ClassAssistant = (Label)e.Item.FindControl("lbl_ClassAssistant");
            if (CheckUser())
            {
                lnkbtn_Manage.Enabled = true;
                lnkbtn_check.Enabled = true;
                lnkbtn_editor.Enabled = true;
                lbtn.Enabled = true;
                lbtn.Attributes.Add("onClick", "javascript:return confirm('确定删除此记录？');");
            }
            else
            {
                if (login.UserID.ToString() == lbl_ClassLecturer.Text)
                {
                    lnkbtn_editor.Enabled = true;
                    lnkbtn_Manage.Enabled = true;
                }
                else
                {
                    lnkbtn_editor.Enabled = false;
                    if (login.UserID.ToString() == lbl_ClassLecturer.Text || login.UserID.ToString() == lbl_ClassLeader.Text || login.UserID.ToString() == lbl_ClassAssistant.Text)
                        lnkbtn_Manage.Enabled = true;
                    else
                        lnkbtn_Manage.Enabled = false;

                }

                lnkbtn_check.Enabled = false;
                lbtn.Enabled = false;
            }
        }
    }

    protected void btnSearch_Click(object sender, EventArgs e)
    {
        string search = GetSearch();
        BinderPager(search);
        BinderPG(search,1);
    }
    protected void btnAddNew_Click(object sender, EventArgs e)
    {
        string url = "AddClass.aspx";
        Script.RedirectURL(url);

        //if (!string.IsNullOrEmpty(txtNewTitle.Text))
        //{
        //    VODLProvince vo = new VODLProvince();
        //    vo.Province = txtNewTitle.Text.Trim();
        //    vo.CityNum = 0;
        //    obj.Add(vo);

        //}
        //txtNewTitle.Text = "";
        //string search = GetSearch();
        //BinderPager(search);
        //BinderPG(search, AspNetPager1.CurrentPageIndex);

    }
  
    protected void AspNetPager1_PageChanged(object sender, EventArgs e)
    {
        string search = GetSearch();
        BinderPG(search, AspNetPager1.CurrentPageIndex);
    }
    protected void rptNew_ItemCommand(object source, RepeaterCommandEventArgs e)
    {
        Label lbl_msg = (Label)e.Item.FindControl("lbl_msg");

        if (e.CommandName.ToLower() == "leditor")
        {

            string url = "AddClass.aspx?CID=" + e.CommandArgument.ToString();
                Script.RedirectURL(url);
           
        }
        else if (e.CommandName.ToLower() == "ldel")
        {
            if (objClass.Del(int.Parse(e.CommandArgument.ToString())))
                {
                    string search = GetSearch();
                    BinderPager(search);
                    BinderPG(search, AspNetPager1.CurrentPageIndex);
                }
                else
                {
                    lbl_msg.Text = GetLanageValueByKey("Msg_ManagerQuestion_WorkNo", PowerCreator.LMS.Language.LanagetItemType.Page);
                }
           
        }
        else if (e.CommandName.ToLower() == "lcheck")
        {
            VOTOClass vo = new VOTOClass();
            vo = objClass.Load(int.Parse(e.CommandArgument.ToString()));
            if (vo.Broswer)
                vo.Broswer = false;
            else
                vo.Broswer = true;
            objClass.Update(vo);


            string search = GetSearch();
            BinderPager(search);
            BinderPG(search, 1);
        }
        else if (e.CommandName.ToLower() == "lmanage")
        {
            string url = "ManageClassMember.aspx?CID=" + e.CommandArgument.ToString();
            Script.RedirectURL(url);
        } 
       
    }
    protected void chkAll_CheckedChanged(object sender, EventArgs e)
    {
        chkCancel.Checked = false;
        //全选 / 取消
        for (int i = 0; i < rptNew.Items.Count; i++)
        {
            CheckBox cbox = (CheckBox)rptNew.Items[i].FindControl("Chbox_Check");
            if (chkAll.Checked)
                cbox.Checked = true;
            else
                cbox.Checked = false;
        }
    }
    protected void chkCancel_CheckedChanged(object sender, EventArgs e)
    {
        chkAll.Checked = false;
        //反选
        for (int i = 0; i < rptNew.Items.Count; i++)
        {
            CheckBox cbox = (CheckBox)rptNew.Items[i].FindControl("Chbox_Check");
            if (cbox.Checked)
                cbox.Checked = false;
            else
                cbox.Checked = true;
        }
    }
    protected void btn_DelCheck_Click(object sender, EventArgs e)
    {
        try
        {
            for (int i = 0; i < rptNew.Items.Count; i++)
            {
                CheckBox cbox = (CheckBox)rptNew.Items[i].FindControl("Chbox_Check");
                Label lbl_classid = (Label)rptNew.Items[i].FindControl("lbl_classid");
                if (cbox.Checked)
                {

                    if (objClass.Del(int.Parse(lbl_classid.Text)))
                        {
                            
                        }
                        else
                        {
                            Script.Alert(this, "msg", GetLanageValueByKey("Msg_ManagerQuestion_WorkNo", PowerCreator.LMS.Language.LanagetItemType.Page));
                        }
                    
                }
            }
            string search = GetSearch();
            BinderPager(search);
            BinderPG(search, AspNetPager1.CurrentPageIndex);
            Script.Alert(this, "msg", GetLanageValueByKey("Msg_ManagerQuestion_WorkOK", PowerCreator.LMS.Language.LanagetItemType.Page));
        }
        catch
        {
            Script.Alert(this, "msg", GetLanageValueByKey("Msg_ManagerQuestion_WorkNo", PowerCreator.LMS.Language.LanagetItemType.Page));
        }
    }

    protected void Button1_Click(object sender, EventArgs e)
    {
        string url = "ClassRank.aspx";
        Script.RedirectURL(url);
    }
}


